package cn.njyd.corejava.thread.myday01;

class ThreadDemo05 extends Thread{
    int num = 50;
    public void run(){
        while(true) {
            if (num>0) {
                System.out.println(Thread.currentThread().getName()+"卖了一张，还剩"+(--num));
            } else {
                System.out.println("卖完了");
                break;
            }
        }
    }
}


public class MyThread05 {
    public static void main(String[] args) {
        ThreadDemo05 t1 = new ThreadDemo05();
        t1.setName("南京南站");
        t1.start();
        ThreadDemo05 t2 = new ThreadDemo05();
        t2.setName("南京北站");
        t2.start();
    }
}
